<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .active{
      background-color: rgb(201, 32, 32);
    }
    .box{
      width:200px;
      height: 200px;
      border:1px solid #ccc;
      font-size: 30px;
      text-align: center;
      line-height: 200px;
    }
  </style>
  <script src="vue.js"></script>
</head>
<body>
  <div id="app">
    <input 
      type="button" 
      v-for="(fruit,i) in arr" 
      :class=" { active : index == i } "
      :value="fruit"
      @click="change(i)"
      >
   
    <div class="box" v-for="(fruit,i) in arr" v-if="index==i">{{ fruit }}</div>
    
  </div>
  <script>
    let vm = new Vue({
      el:"#app",
      data:{
        arr:["香蕉",'苹果',"梨子"],
        index : 0
      },
      methods:{
        change(index){
          this.index = index;
        }
      }
    })
  </script>
</body>
</html>